package com.zbkj.crmeb.enums;

import java.util.ArrayList;
import java.util.List;

import com.fasterxml.jackson.annotation.JsonFormat;

/**
 * x
 *
 * @author muyu.myw
 * @date 2020/9/28 12:18
 */

@JsonFormat(shape = JsonFormat.Shape.OBJECT)
public enum StockAreaTempEnum {
	CN(1, 1, "大陆", "CONTINENTAL CHINA", "CINA CONTINENTALE"), 
	HK(2, 2, "港澳", "HONG KONG MACAO", "HONG KONG MACAO"),
	EUR(3, 3, "欧洲", "EUROPE", "EUROPA"),

	BA(4, 4, "保税区", "CUSTOMS DEPOSIT", "DEPOSITO DOGANALE"), 
	FR(5, 5, "法国", "FRANCE", "FRANCIA"),
	KR(6, 6, "韩国", "SOUTH KOREA", "COREA DEL SUD"), 
	AUS(7, 7, "澳洲", "AUSTRALIA", "AUSTRALIA"),
	GER(8, 8, "德国", "GERMANY", "GERMANIA"), 
	JPN(9, 9, "日本", "JAPAN", "GIAPPONE"),
	US(10, 10, "美国", "UNITED STATES", "STATI UNITI"),
	IT(11, 11, "意大利", "ITALY", "ITALY"),
	HK_EFASION(12, 12, "香港仓", "HK EFASION", "HK EFASION"),
//	CN_066(13, 13, "066仓", "CN_066", "CN_066"),
	BA_WZ(16, 16, "温州保税仓", "温州保税仓", "温州保税仓"), 
	BA_HK(14, 14, "香港保税仓", "HK BONDED WAREHOUSE", "Sistema monetario europeo"),
	BA_CH(15, 15, "国内保税仓", "CONTINENTAL CHINA BONDED WAREHOUSE","Zone franche interne"),
	
	;

	Integer tempId;
	Integer stockAreaCode;
	String stockAreaName;

	public String getEnAreaName() {
		return enAreaName;
	}

	public void setEnAreaName(String enAreaName) {
		this.enAreaName = enAreaName;
	}

	public String getItAreaName() {
		return itAreaName;
	}

	public void setItAreaName(String itAreaName) {
		this.itAreaName = itAreaName;
	}

	public void setTempId(Integer tempId) {
		this.tempId = tempId;
	}

	public void setStockAreaCode(Integer stockAreaCode) {
		this.stockAreaCode = stockAreaCode;
	}

	public void setStockAreaName(String stockAreaName) {
		this.stockAreaName = stockAreaName;
	}

	String enAreaName;
	String itAreaName;

	public Integer getTempId() {
		return tempId;
	}

	public Integer getStockAreaCode() {
		return stockAreaCode;
	}

	public String getStockAreaName() {
		return stockAreaName;
	}

	public static StockAreaTempEnum valueOf(Integer code) {
		for (StockAreaTempEnum value : values()) {
			if (value.getTempId() == code) {
				return value;
			}
		}

		return null;
	}
	
	public static List<Integer> listValue() {
		List<Integer> list = new ArrayList<>();
		for (StockAreaTempEnum value : values()) {
			list.add(value.getStockAreaCode());
		}
		
		return list;
	}
	
	public static List<StockAreaTempEnum> listEnum() {
		List<StockAreaTempEnum> list = new ArrayList<>();
		for (StockAreaTempEnum value : values()) {
			list.add(value);
		}
		
		return list;
	}

	private StockAreaTempEnum(Integer tempId, Integer stockAreaCode, String stockAreaName, String enAreaName,
			String itAreaName) {
		this.tempId = tempId;
		this.stockAreaCode = stockAreaCode;
		this.stockAreaName = stockAreaName;
		this.enAreaName = enAreaName;
		this.itAreaName = itAreaName;
	}

	public static StockAreaTempEnum getByTempId(Integer tempId) {
		if (tempId != null) {
			for (StockAreaTempEnum val : StockAreaTempEnum.values()) {
				if (val.tempId.equals(tempId)) {
					return val;
				}
			}
		}
		return HK;
	}
}
